{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c5e0ea0f",
   "metadata": {},
   "outputs": [],
   "source": [
    "# from transformers import AutoImageProcessor\n",
    "\n",
    "# name = 'facebook/detr-resnet-50'\n",
    "# AutoImageProcessor.from_pretrained(name).save_pretrained('processor/' + name)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "fe8dc7a2-b442-416d-ae17-17c1d0a8dcf0",
   "metadata": {},
   "outputs": [],
   "source": [
    "# from transformers import TrOCRProcessor\n",
    "\n",
    "# name = 'microsoft/trocr-base-handwritten'\n",
    "# TrOCRProcessor.from_pretrained(name).save_pretrained('processor/' + name)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "37bfb12a",
   "metadata": {},
   "outputs": [],
   "source": [
    "from datasets import load_dataset\n",
    "\n",
    "name = 'lansinuote/ocr_id_card_small'\n",
    "load_dataset(name).save_to_disk('dataset/' + name)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c3ac989a",
   "metadata": {},
   "outputs": [],
   "source": [
    "from transformers import AutoModelForObjectDetection\n",
    "\n",
    "name = 'facebook/detr-resnet-50'\n",
    "AutoModelForObjectDetection.from_pretrained(name).save_pretrained(\n",
    "    'model/' + name, ignore_mismatched_sizes=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e8e71ac5-4c9d-463a-adea-5d6f94744da2",
   "metadata": {},
   "outputs": [],
   "source": [
    "from transformers import VisionEncoderDecoderModel\n",
    "\n",
    "name = 'microsoft/trocr-base-stage1'\n",
    "VisionEncoderDecoderModel.from_pretrained(name).save_pretrained('model/' +\n",
    "                                                                name)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python [conda env:pt]",
   "language": "python",
   "name": "conda-env-pt-py"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
